﻿using System;
using DotNetPy;

namespace CsConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            PyEngine pyEngine = new PyEngine();
            if (pyEngine.PyInitialize()) // 初始化PyEngine
            {
                pyEngine.PySetModulePath(null); // null 默认当前路径否则填绝对路径
                if (pyEngine.PyImportFunc("t123", "F") && pyEngine.PyImportFunc("t123", "D"))
                {
                    object[] argss = new object[] { 1 }; // 添加参数
                    object obj = pyEngine.PyCallFunc("F", argss); // 执行函数
                    Console.WriteLine("Result:" + obj);
                    argss = new object[] { "HALO" }; // 添加参数
                    obj = pyEngine.PyCallFunc("D", argss); // 执行函数
                    Console.WriteLine("Result:" + obj);
                    //int[] a = ((int[])obj);
                    //for (int i = 0; i < a.Length; i++)
                    //{
                    //    Console.WriteLine(a[i]);
                    //}
                }
                //if (pyEngine.PyImportModule("t123"))
                //{
                //    object[] argss = new object[] { "1", "@" }; // 添加参数
                //    object obj = pyEngine.PyCallFuncFromModule("t123", "F", argss); // 执行函数
                //    Console.WriteLine(obj);
                //}
            }
            pyEngine.PyFinalize();
            Console.ReadLine();
        }
    }
}
